package com.xqboss.system.domain.dto;

import com.xqboss.common.core.text.Convert;

import java.util.Objects;

/**
 * @author Trent
 * @date 2023/9/11
 */
public class BoolConfigKey implements SysConfigKey<Boolean> {

    private final String key;
    private final Boolean defaultValue;

    public BoolConfigKey(String key){
        this(key, null);
    }

    public BoolConfigKey(String key, Boolean defaultValue){
        this.key = key;
        this.defaultValue = defaultValue;
    }

    @Override
    public String getKey() {
        return key;
    }

    @Override
    public Boolean convertValue(String value) {
        return Convert.toBool(value, defaultValue);
    }
}
